/*
 * @Author: czy
 * @Date: 2021-05-31 16:15:43
 * @LastEditTime: 2021-06-05 23:05:39
 */
#include "stdarg.h"
#include "string.h"

#include "stdio.h"
#include "vector.h"
#include "malloc.h"

#include "api/system.h"

int testvector(int argc, char *argv[])
{
    printf("\n\033[32mBefore append:\n");
    top();
    printf("\033[0m\n");
    int size = 10000;
    printf("\033[35mAppend %d num.(from 1 to %d)\n\033[0m", size, size);
    Vector vector = newVector(int);
    for (int i = 0; i < size; i++)
    {
        vector.append(&vector, i + 1);
    }
    printf("\n\033[32mAfter append:\n");
    top();
    printf("\033[0m\n");
    printf("\033[35mFirst num: \033[0m%d\n", *(int *)vector.get(&vector, 0));
    printf("\033[35mLast num: \033[0m%d\n", *(int *)vector.get(&vector, -1));
    vector.clear(&vector);
    printf("\n\033[32mAfter clear:\n");
    top();
    printf("\033[0m\n");
}